This allows ResourceLoader::filter() to handle this case slightly
faster, since it searches for this annotation from the beginning.
In practice this is a negligible performance optimization, but let's
set a good example for the future.
Also tweak the comments and whitespace:
* Move comment about the FILTER_NOMIN from doc comment to code comment,
it's an implementation detail and not meant for public documentation
* Remove duplicated documentation from the parent class
* Change whitespace to be identical in both cases
Change-Id: I624914ff28d903027ba58710708ccc3c66af9e24
* @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
- return Xml::encodeJsCall( 'mw.user.options.set',
+ // Use FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
+ return ResourceLoader::FILTER_NOMIN . Xml::encodeJsCall(
+ 'mw.user.options.set',
[ $context->getUserObj()->getOptions( User::GETOPTIONS_EXCLUDE_DEFAULTS ) ],
ResourceLoader::inDebugMode()
- ) . ResourceLoader::FILTER_NOMIN;
+ );
}
/**
}
/**
- * Generate the JavaScript content of this module.
- *
- * Add FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
- *
* @param ResourceLoaderContext $context
* @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
- return Xml::encodeJsCall(
+ // Use FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
+ return ResourceLoader::FILTER_NOMIN . Xml::encodeJsCall(
'mw.user.tokens.set',
[ $this->contextUserTokens( $context ) ],
ResourceLoader::inDebugMode()
- ) . ResourceLoader::FILTER_NOMIN;
+ );
}
/**